package com.atguigu.gmall.search.pojo;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.List;

@Data
@Document(indexName = "goods", type = "info", shards = 3, replicas = 2)
public class GoodsVO {
    @Id
    private Long id;  //skuId
    @Field(type = FieldType.Keyword,index = false)
    private String pic; //sku的默认图片
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String name;//这是需要检索的sku的标题
    @Field(type = FieldType.Double)
    private double price;//sku-price；
    @Field(type = FieldType.Long)
    private Integer sale;//sku-sale 销量
    @Field(type = FieldType.Long)
    private Long brandId; //品牌id
    @Field(type = FieldType.Keyword)
    private String brandName;  //品牌名
    @Field(type = FieldType.Long)
    private Long productCategoryId;  //sku的分类id
    @Field(type = FieldType.Keyword)
    private String productCategoryName; //sku的名字
    @Field(type = FieldType.Long)
    private Long stock;//sku-stock 库存
    @Field(type = FieldType.Integer)
    private Integer sort;//排序分 热度分

    //保存当前sku所有需要检索的属性；
    //检索属性来源于spu的基本属性中的search_type=1（销售属性都已经拼接在标题中了）
    @Field(type = FieldType.Nested)
    private List<SpuAttributeValueVO> attrValueList;//检索属性
}
